﻿using System;
using System.Windows.Media.Imaging;
using System.Windows.Media;

namespace DotNetImage.Imaging.BasicFilters
{
    public class ResizeFilter : FilterBase
    {
        public ResizeFilter() { HasMultiThreadingSupport = true; }

        [ParameterAttribute(Name = "Width", DefaultValue = 1, MinValue=1, MaxValue=Int32.MaxValue, Step=1)]
        public int Width { get; set; }

        [ParameterAttribute(Name = "Height", DefaultValue = 1, MinValue = 1, MaxValue = Int32.MaxValue, Step = 1)]
        public int Height { get; set; }

        [ParameterAttribute(Name = "Quality", DefaultValue = (double)BitmapScalingMode.HighQuality)]
        public BitmapScalingMode Quality { get; set; }

        protected override void ProcessPerPixel(DotNetImage bmp)
        {
            bmp.BitmapImage.BeginInit();
            bmp.BitmapImage.Rotation = Rotation;
            bmp.BitmapImage.EndInit();
        }
        protected override void ProcessMT(DotNetImage bmp)
        {
            ProcessPerPixel(bmp);
        }

        protected override uint ProcessPixel(uint pixel) {/* there is nothing to do */ return 0; }

        protected override void ValidateArguments(){ /* there are no parameters to validate */ }
    }
}
